﻿@model WebApp.Models.S_user

@{
    Layout = "~/Views/Shared/_DialogLayout.cshtml";
}

@using (Html.BeginForm("", "", FormMethod.Post, new { @class = "form-horizontal form-inline", id = "inputform" }))
{
    <div class="dialog-content">
        @Html.AntiForgeryToken()
        @Html.ValidationSummary(true, "", new { @class = "text-danger" })

        <input type="hidden" id="Id" value="@Model.Id" class="form-control datafield" data-fieldname="Id" />
        <input type="hidden" value="@(Model.Updatetime.HasValue ? Model.Updatetime.Value.ToString("yyyy-MM-dd HH:mm:ss.fff") : "")" class="form-control datafield" data-fieldname="Updatetime" />

        <div class="row">
            <div class="col-xs-12 nopadding">
                <div class="widget-box">
                    <div class="widget-title">
                        <h5>用户基本信息</h5>
                    </div>
                    <div class="widget-content">
                        <table cellpadding="3" cellspacing="0" border="0" class="inputform">
                            <tr>
                                <td class="td-label"><label for="Username">用户名<span style="color:red;">*</span></label></td>
                                <td class="td-control">
                                    @Html.TextBox("Username", @Model.Username, new { @class = "form-control datafield", @data_fieldname = "Username", style = "width:200px;" })
                                </td>
                                <td class="td-label"></td>
                                <td class="td-control"></td>
                            </tr>
                            <tr>
                                <td class="td-label"><label for="Realname">姓名<span style="color:red;">*</span></label></td>
                                <td class="td-control">
                                    @Html.TextBox("Realname", @Model.Realname, new { @class = "form-control datafield", @data_fieldname = "Realname", style = "width:200px;" })
                                </td>
                                <td class="td-label"><label for="Mobile">手机</label></td>
                                <td class="td-control">
                                    @Html.TextBox("Mobile", @Model.Mobile, new { @class = "form-control datafield", @data_fieldname = "Mobile", style = "width:200px;" })
                                </td>
                            </tr>
                            <tr>
                                <td class="td-label"><label for="Sex">性别</label></td>
                                <td class="td-control">
                                    @Html.DropDownList("Sex", ViewBag.GenderList as SelectList, new { @class = "form-control datafield", @data_fieldname = "Sex", style = "width:200px;" })
                                </td>
                                <td class="td-label"><label for="Email">邮箱<span style="color:red;">*</span></label></td>
                                <td class="td-control">
                                    @Html.TextBox("Email", @Model.Email, new { @class = "form-control datafield", @data_fieldname = "Email", style = "width:200px;" })
                                </td>
                            </tr>
                            <tr>
                                <td class="td-label"><label for="Tel">电话</label></td>
                                <td class="td-control">
                                    @Html.TextBox("Tel", @Model.Tel, new { @class = "form-control datafield", @data_fieldname = "Tel", style = "width:200px;" })
                                </td>
                                <td class="td-label"><label for="Remark">备注</label></td>
                                <td class="td-control">
                                    @Html.TextArea("Remark", @Model.Remark, new { @class = "form-control datafield", @data_fieldname = "Remark", style = "width:200px;" })
                                </td>
                            </tr>
                        </table>
                    </div>
                </div>
            </div>
        </div>
        @if (Model.Id == 0)
        {
            <div class="row">
                <div class="col-xs-12 nopadding">
                    <div class="widget-box">
                        <div class="widget-title">
                            <h5>初始密码</h5>
                        </div>
                        <div class="widget-content">
                            <table cellpadding="3" cellspacing="0" border="0" class="inputform">
                                <tr>
                                    <td class="td-label"><label for="Password">初始密码</label></td>
                                    <td class="td-control">
                                        @Html.Password("Password", @Model.Password, new { @class = "form-control datafield", @data_fieldname = "Password", style = "width:200px;" })
                                    </td>
                                    <td class="td-label"><label for="ConfrimPassword">再输一次</label></td>
                                    <td class="td-control">
                                        @Html.Password("ConfrimPassword", @Model.Password, new { @class = "form-control datafield", @data_fieldname = "Password", style = "width:200px;" })
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        }
        <div class="row">
            <div class="col-xs-12 nopadding">
                <div class="widget-box">
                    <div class="widget-title">
                        <h5>用户角色</h5>
                    </div>
                    <div class="widget-content">
                        <div class="row">
                            <div class="col-sm-12">
                                <table class="table table-condensed responsive grid-edit" id="list_table">
                                    <tbody>
                                        <tr>
                                            <td colspan="3">
                                                <div style="text-align:right">
                                                    <a href="#none" class="btn btn-mini btn-default checkAll">全选</a>
                                                    <a href="#none" class="btn btn-mini btn-default clearAll">清空</a>
                                                </div>
                                            </td>
                                        </tr>
                                    </tbody>
                                    <thead>
                                        <tr>
                                            <td style="text-align:left;">角色名称</td>
                                            <td style="text-align:left;">角色描述</td>
                                            <td width="60">选择</td>
                                        </tr>
                                    </thead>
                                    <tbody class="list-template hidden"></tbody>
                                    <tbody class="list-data">
                                        @foreach (var role in ViewBag.RoleList as IList<WebApp.ViewModels.Manage.UserRoleModel>)
                                        {
                                            <tr>
                                                <td style="text-align:left;">@role.Rolename</td>
                                                <td style="text-align:left;">@role.Description</td>
                                                <td>
                                                    @Html.CheckBox("Ischecked", role.Ischecked, new { @data_fieldname = "Ischecked" })
                                                    @Html.Hidden("Roleid", role.Roleid)
                                                </td>
                                            </tr>
                                        }
                                    </tbody>
                                    <tbody class="list-del hidden"></tbody>
                                    <tbody>
                                        <tr>
                                            <td colspan="3">
                                                <div style="text-align:right">
                                                    <a href="#none" class="btn btn-mini btn-default checkAll">全选</a>
                                                    <a href="#none" class="btn btn-mini btn-default clearAll">清空</a>
                                                </div>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <br />
    </div>
    <div class="dialog-footer">
        <button id="btncancel" class="btn btn-small btn-default">取消</button>
        <button id="btnsave" class="btn btn-small btn-primary">保存</button>
    </div>
}

@section css{
    <style type="text/css">
        .show-grid {
            margin-bottom: 10px;
        }

        .table-bordered {
            border: 1px solid #ddd;
        }
    </style>
}



@section scripts{
    <script type="text/javascript" src="~/Scripts/app/app.validator.js?ver=@WebApp.BLL.CommonStr.Ver"></script>
    <script type="text/javascript" src="~/Scripts/app/manage/user.edit.js?ver=@WebApp.BLL.CommonStr.Ver"></script>
}